﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CCPnuts.Pack;

namespace CCPnuts.IFileSplit.Interfaces
{
    /// <summary>
    /// The spliter of file
    /// </summary>
    public interface I_Spliter : I_Interface
    {
        #region Essential Members

        /// <summary>
        /// Gets or sets the size of each split file.
        /// </summary>
        long SplitSize { get; set; }

        /// <summary>
        /// Gets or sets the source file.
        /// </summary>
        string SourceFile { get; set; }

        /// <summary>
        /// Gets or sets the tareget directory.
        /// </summary>
        string TargetDirectory { get; set; }

        /// <summary>
        /// Split the file. This is a synchronous method.
        /// </summary>
        void Split();

        #endregion

        #region Optional Members

        /// <summary>
        /// Gets the size of the source file. 
        /// </summary>
        [Optional]
        long FileSize { get; }

        /// <summary>
        /// Gets or sets the number of the part files.
        /// </summary>
        [Optional]
        int FileCount { get; }

        /// <summary>
        /// Begin a split. This is a asynchronous method.
        /// </summary>
        [Optional]
        IAsyncResult BeginSplit(AsyncCallback callback);

        /// <summary>
        /// End a split. This is a asynchronous method.
        /// </summary>
        /// <param name="result"></param>
        [Optional]
        void EndSplit(IAsyncResult result);

        #endregion
    }

    /// <summary>
    /// The static & cons. members of Spliter.
    /// </summary>
    public interface S_Spliter : S_Interface
    {
        I_Spliter _Cons();

        [Optional]
        I_Spliter _Cons(string sourceFile);
    }

    public static partial class InterfaceManager
    {
        public static S_Spliter Spliter { internal get; set; }
    }
}
